package com.web.common.web.session;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import com.css.sword.kernel.platform.SwordSession;
import com.css.sword.kernel.utils.SwordSessionUtils;
import com.css.sword.platform.web.session.ISwordSessionDataCreater;

public class SwordSessionBizDataMH implements ISwordSessionDataCreater {

	@Override
	public void createSessionData(HttpServletRequest request,
			SwordSession swordSession) {
		HttpSession hs = request.getSession();
		Object yhm = hs.getAttribute("yhm");
		
		if (yhm != null && !"".equals(yhm)) {
			SwordSessionUtils.putTempDataIntoApplicationContext("yhm", yhm);
		}
	}
	
	public Map<String, Object> getSessionAndValidate(HttpServletRequest request) {
		Map<String, Object> map = new HashMap<String, Object>();
		HttpSession hs = request.getSession();
		Object yhm = hs.getAttribute("yhm");

		if (yhm != null && !yhm.equals("")) {
			map.put("userId", yhm);
		}
		
		return map;
	}
}